package com.线程和进程;

public class MyThread extends Thread {
    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(getName() + ":" + i);
            try {
                Thread.sleep(0);
                /*static void sleep(long millis, int nanos)
                    导致正在执行的线程以指定的毫秒数加上指定的纳秒数来暂停（临时停止执行），
                这取决于系统定时器和调度器的精度和准确性。*/
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
